﻿<?php
// ------------------------------------------------------------------
// NEEDED STUBS FOR THIS EXAMPLE
// ------------------------------------------------------------------


// this will include all needed files to be able to build a Request
include_once($CONF["STUBS_FOLDER"]."Map24MapletRemoteControl/Map24MapletRemoteControl.php5");


// ------------------------------------------------------------------
// NEEDED PARAMETERS FOR THIS REQUEST
// ------------------------------------------------------------------


// coordinates of the location and html-object to add
$longitude 	= "521.0196";
$latitude 	= "3006.554";

// symbol used 	to display the location
$symbolId	= "5";

// html of the html-object
$html ='<![CDATA[
        <div style="font-family: Arial; width:310px; font-size:11; nose-background-color: #ff9966; nose-color: @{BORDER_COLOR}; nose-width: 1px; nose-offset: 1px; padding:0px; border: 1px solid @{BORDER_COLOR};">
          <div style="width:310px; padding: 7 0 1 15; background-color:#ff9966; color: #000099 border-bottom: 1px solid #CCCCCC">
            <table width="303" cellspacing="0" cellpadding="0">
              <tr>
                <td width="200">
                  <span style="font-size:13">
                    <b>Frankfurt</b>
                  </span>
                </td>
                <td>
                  <div style="padding-top:5px; width:75px">
                    <img style="max-width:70px" src="@{RSS_CHANNEL_IMAGE}"/>
                  </div>
                </td>
                <td width="15" style="padding-top:4px">
                  <a href="control:close">
                    <img src="http://img.map24.com/logos/html_20060829/close.gif"/>
                  </a>
                </td>
              </tr>
            </table>
          </div>

          <div style="width:310px; opacity:0.9; color: @{FG_COLOR}; background-color: #ffcc99; border-bottom: 1px solid #CCCCCC; padding: 5 15; max-height:120px; overflow: auto">

           	<b>Goethestr.</b><br/>
           	60311 Frankfurt<br/>

          </div>
	<div style="width:310px; padding-left:15px; padding-top:5px; padding-bottom:5px; padding-right:2px; background-color:rgb(255,255,255);">
      <table width="303">
		<tr>
			<td style="color:rgb(85,85,85);">
				<b>Map24 Options</b>
			</td>
			<td width="100">
				<img style="padding-right:3" src="http://img.map24.com/logos/html_20060829/list.gif"/>
				<a style="visited:#0072BC;link:#0072BC;hover:#0d3d6a;" onclick="control:disable" href="javascript:evFunc(1,${LOC_LONG},${LOC_LAT},\'Focus News\');" title="none" target="_self">Start</a>
			</td>
			<td width="100">
				<img style="padding-right:3" src="http://img.map24.com/logos/html_20060829/list.gif"/>
				<a style="visited:#0072BC;link:#0072BC;hover:#0d3d6a;" onclick="control:disable" href="javascript:evFunc(2,${LOC_LONG},${LOC_LAT},\'Focus News\');" title="none" target="_self">Destination</a>
			</td>
		</tr>
	</table>
  </div>

</div>
]]>';

// Other html - just try this one for testing
// $html = "<![CDATA[<div width=\"200\" height=\"150\" line-height=\"5\" bgcolor=\"255,255,240\">Guck Guck !!</div>]]>";

// the orientation of the html-object on the map relative to the coordinates
$htmlOrientationVertical = "CENTER";
$htmlOrientationHorizontal = "RIGHT";
$htmlOrientationVOffset = "0";
$htmlOrientationHOffset = "20";

// zoomlevel
$mapViewClippingWidth = 2000;


// ------------------------------------------------------------------
// BUILDING THE REQUEST
// ------------------------------------------------------------------


// here are all commands defined and are put together in one ArrayOfCommands

// this object will add a new location
$cmdIdx=0;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->DeclareMap24Location = new DeclareMap24Location();
$commands[$cmdIdx]->DeclareMap24Location->MapObjectID = "location";
$commands[$cmdIdx]->DeclareMap24Location->Coordinate = new Coordinate();
$commands[$cmdIdx]->DeclareMap24Location->Coordinate->Longitude = $longitude;
$commands[$cmdIdx]->DeclareMap24Location->Coordinate->Latitude = $latitude;
$commands[$cmdIdx]->DeclareMap24Location->SymbolID = $symbolId;

// this object will create and add the html-object
$cmdIdx++;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->DeclareMap24HTMLObject = new DeclareMap24HTMLObject();
$commands[$cmdIdx]->DeclareMap24HTMLObject->MapObjectID = "html";
$commands[$cmdIdx]->DeclareMap24HTMLObject->Coordinate = new Coordinate();
$commands[$cmdIdx]->DeclareMap24HTMLObject->Coordinate->Longitude = $longitude;
$commands[$cmdIdx]->DeclareMap24HTMLObject->Coordinate->Latitude = $latitude;
$commands[$cmdIdx]->DeclareMap24HTMLObject->HTML = $html;
$commands[$cmdIdx]->DeclareMap24HTMLObject->Orientation = new MapObjectOrientation();
$commands[$cmdIdx]->DeclareMap24HTMLObject->Orientation->Vertical = $htmlOrientationVertical;
$commands[$cmdIdx]->DeclareMap24HTMLObject->Orientation->Horizontal = $htmlOrientationHorizontal;
$commands[$cmdIdx]->DeclareMap24HTMLObject->Orientation->VOffset = $htmlOrientationVOffset;
$commands[$cmdIdx]->DeclareMap24HTMLObject->Orientation->HOffset = $htmlOrientationHOffset;

// this object will enable the new location on the map
$cmdIdx++;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->ControlMapObject = new ControlMapObject();
$commands[$cmdIdx]->ControlMapObject->Control = "SHOW"; //SHOW or ENABLE
$commands[$cmdIdx]->ControlMapObject->MapObjectIDs = array("location","html");
$cmdIdx++;

// this object will center the map above the new location
$cmdIdx++;
$commands[$cmdIdx] = new XMLCommandWrapper();
$commands[$cmdIdx]->SetMapView = new SetMapView();
$commands[$cmdIdx]->SetMapView->MapObjectIDs = array("location","html");
$commands[$cmdIdx]->SetMapView->ClippingWidth = new SetMapViewClippingWidth();
$commands[$cmdIdx]->SetMapView->ClippingWidth->MinimumWidth = $mapViewClippingWidth;


// definition of the request header with Map24ID and SessionID
$header = new RequestHeader();
$header->Map24ID  = $CONF['MAP24_ID'];
$header->ClientID = $CONF['SESSION_ID'];

// definition of the request body
$request = new MapletRemoteControlRequest();
$request->Map24MRC = new Map24MRC();
$request->Map24MRC->Commands = $commands;


// ------------------------------------------------------------------
// EXECUTE THE REQUEST
// ------------------------------------------------------------------
// in this object the SoapClient will be initiated and executed


$mrc = new Map24MapletRemoteControl($CONF['MAPTP_SYSTEM'],$CONF['MAP24_ID'],$CONF['SESSION_ID']);
$response = $mrc->mapletRemoteControl($header,$request);


// ------------------------------------------------------------------
// OUTPUT THE RESULT
// ------------------------------------------------------------------


$resultString = "This command generates no output";
$counter = 0;

?>